package HospitalSystem.src;

import java.util.ArrayList;

public class AdminnistrativeList {
    ArrayList<Administrative> AdList = new ArrayList<>();

    public AdminnistrativeList(){

    }
    public void createNewAd(String name){
        AdList.add(new Administrative(name));
    }
    public void removeAd(String name){
        for (int i = 0; i < AdList.size(); i++) {
            if (AdList.get(i).getAdname().equals(name)){
                System.out.println(name + "此的科室不存在");
            }
            else if(AdList.get(i).getDoctorList().isEmpty()){
                System.out.println(name + "此科室还有医生");
            }
            else if(AdList.get(i).getAdname().equals(name) && AdList.get(i).getDoctorList().isEmpty()){
                AdList.remove(i);
            }
            else{
                System.out.println("错误");
            }
        }
    }
}
